#ifndef GRAPH_H
#define GRAPH_H

#include <memory>
#include <list>
#include <vector>
#include <QtGui/QMainWindow>
#include <QtCore>
#include "ui_graph.h"
#include <QVector>
#include <qwt_plot_grid.h>
#include <qwt_legend.h>
#include <qwt_plot_curve.h>
#include <qwt_plot_zoomer.h>
#include <qwt_scale_draw.h>
#include <qwt_scale_widget.h>
#include <Eigen/Dense>

#include <qwthelper.h>

#include "oilpipe.h"
#include "hydraulics.h"

using std::auto_ptr;
using std::list;
using std::vector;
using Eigen::VectorXd;

using namespace pdelib::force_flow;
using namespace pdelib::gravity_flow;
using namespace pdelib::combined_flow;
using namespace pdelib::force_nonisotherm;
using namespace hydraulics;


class graph : public QMainWindow
{
	Q_OBJECT

public:
	graph(QWidget *parent = 0, Qt::WFlags flags = 0);
	~graph();
private slots:
    void initGraph();

	void on_btnSolver_clicked();

	void on_slTime_valueChanged();
	void graphicsDraw(int current_time);
    void get_setting_from_GUI(oilpipe_parameters* params, 
        pressure_series_equation* p_left, pressure_series_equation* p_right);

private:
	Ui::graphClass ui;
    
    auto_ptr<SimpleQwt> plot;

    /*QwtLegend* leg[2];
    QwtPlotGrid* grid[2];
    QwtPlotCurve* curves[2][3];
    //QwtPlotCurve*curv2;
	QwtPlotZoomer* zoom[2][3];*/

    //list<vector<VectorXd> > pde_data[2];
    list<vector<double>> pde_data;
	list<double> pde_time;

    pipeline_profile_t pipe_profile;
};

#endif // GRAPH_H
